import {computed, h, ref, unref} from 'vue';
import {NAvatar, NSwitch, NTag} from 'naive-ui';
// import TableItemSwitch from './tableItemSwitch.vue'
import {acceptHMRUpdate} from "pinia";

export const columns = [
  {
    title: "主播ID",
    key: "anchorId",
    width:80
  },
  {
    title: '直播时间',
    key: 'startTime',
    width: 200
},
  {
    title: "主播名称",
    key: "anchorName",
    width:200
  },

{
    title: '渠道标识',
    key: 'chanId',
    width: 200
}, {
    title: '下载人数',
    key: 'registNum',
    width: 100
}, {
  title: '首日付费',
  key: 'firstDayPayAmount',
  width: 100
}, {
    title: '累计付费',
    key: 'totalPayAmount',
    width: 100
}
];

const switchAction = ref<StatusSwitchAction[]>([]);

export interface StatusSwitchAction {
  type: string
  action: Function
}

function actionFun(type: string) {
  for (let action of unref(switchAction)) {
    if (type === action.type) {
      return action.action;
    }
  }
  return () => {
  }
}

export function registerHandler(actions: StatusSwitchAction[]) {
  switchAction.value = actions
}



